// Copyright (C) Kumo inc. and its affiliates.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//

// Automatically generated file; DO NOT EDIT.

#pragma once

#include <cstdint>
#include <cstring>

#include <ksimd/ksimd.hpp>

#include <nebula/bits/dispatch.h>
#include <turbo/base/ubsan.h>

namespace nebula::internal {
    namespace {

        template<DispatchLevel level>
        struct UnpackBits128 {

            using simd_batch = ksimd::make_sized_batch_t<uint32_t, 4>;

            inline static const uint32_t *unpack0_32(const uint32_t *in, uint32_t *out) {
                memset(out, 0x0, 32 * sizeof(*out));
                out += 32;

                return in;
            }

            inline static const uint32_t *unpack1_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x1;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 1-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{0, 1, 2, 3};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 1-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{4, 5, 6, 7};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 1-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{8, 9, 10, 11};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 1-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{12, 13, 14, 15};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 1-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{16, 17, 18, 19};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 1-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{20, 21, 22, 23};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 1-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{24, 25, 26, 27};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 1-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{28, 29, 30, 31};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 1;
                return in;
            }

            inline static const uint32_t *unpack2_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x3;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 2-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{0, 2, 4, 6};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 2-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{8, 10, 12, 14};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 2-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{16, 18, 20, 22};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 2-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{24, 26, 28, 30};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 2-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{0, 2, 4, 6};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 2-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{8, 10, 12, 14};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 2-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{16, 18, 20, 22};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 2-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{24, 26, 28, 30};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 2;
                return in;
            }

            inline static const uint32_t *unpack3_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x7;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 3-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{0, 3, 6, 9};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 3-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{12, 15, 18, 21};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 3-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 30 | turbo::safe_load<uint32_t>(in + 1) << 2,
                                   turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{24, 27, 0, 1};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 3-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{4, 7, 10, 13};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 3-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{16, 19, 22, 25};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 3-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1) >> 31 | turbo::safe_load<uint32_t>(in + 2) << 1,
                                   turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2)};
                shifts = simd_batch{28, 0, 2, 5};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 3-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2)};
                shifts = simd_batch{8, 11, 14, 17};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 3-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2)};
                shifts = simd_batch{20, 23, 26, 29};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 3;
                return in;
            }

            inline static const uint32_t *unpack4_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0xf;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 4-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{0, 4, 8, 12};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 4-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{16, 20, 24, 28};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 4-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{0, 4, 8, 12};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 4-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{16, 20, 24, 28};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 4-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2)};
                shifts = simd_batch{0, 4, 8, 12};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 4-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2)};
                shifts = simd_batch{16, 20, 24, 28};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 4-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3), turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3), turbo::safe_load<uint32_t>(in + 3)};
                shifts = simd_batch{0, 4, 8, 12};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 4-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3), turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3), turbo::safe_load<uint32_t>(in + 3)};
                shifts = simd_batch{16, 20, 24, 28};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 4;
                return in;
            }

            inline static const uint32_t *unpack5_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x1f;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 5-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{0, 5, 10, 15};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 5-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 30 | turbo::safe_load<uint32_t>(in + 1) << 2,
                                   turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{20, 25, 0, 3};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 5-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{8, 13, 18, 23};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 5-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1) >> 28 | turbo::safe_load<uint32_t>(in + 2) << 4,
                                   turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 2)};
                shifts = simd_batch{0, 1, 6, 11};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 5-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 2) >> 31 | turbo::safe_load<uint32_t>(in + 3) << 1};
                shifts = simd_batch{16, 21, 26, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 5-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3), turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3), turbo::safe_load<uint32_t>(in + 3)};
                shifts = simd_batch{4, 9, 14, 19};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 5-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3) >> 29 | turbo::safe_load<uint32_t>(in + 4) << 3,
                                   turbo::safe_load<uint32_t>(in + 4), turbo::safe_load<uint32_t>(in + 4)};
                shifts = simd_batch{24, 0, 2, 7};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 5-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 4), turbo::safe_load<uint32_t>(in + 4),
                                   turbo::safe_load<uint32_t>(in + 4), turbo::safe_load<uint32_t>(in + 4)};
                shifts = simd_batch{12, 17, 22, 27};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 5;
                return in;
            }

            inline static const uint32_t *unpack6_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x3f;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 6-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{0, 6, 12, 18};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 6-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 30 | turbo::safe_load<uint32_t>(in + 1) << 2,
                                   turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{24, 0, 4, 10};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 6-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1) >> 28 | turbo::safe_load<uint32_t>(in + 2) << 4,
                                   turbo::safe_load<uint32_t>(in + 2)};
                shifts = simd_batch{16, 22, 0, 2};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 6-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2)};
                shifts = simd_batch{8, 14, 20, 26};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 6-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3), turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3), turbo::safe_load<uint32_t>(in + 3)};
                shifts = simd_batch{0, 6, 12, 18};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 6-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3) >> 30 | turbo::safe_load<uint32_t>(in + 4) << 2,
                                   turbo::safe_load<uint32_t>(in + 4), turbo::safe_load<uint32_t>(in + 4)};
                shifts = simd_batch{24, 0, 4, 10};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 6-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 4), turbo::safe_load<uint32_t>(in + 4),
                                   turbo::safe_load<uint32_t>(in + 4) >> 28 | turbo::safe_load<uint32_t>(in + 5) << 4,
                                   turbo::safe_load<uint32_t>(in + 5)};
                shifts = simd_batch{16, 22, 0, 2};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 6-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 5), turbo::safe_load<uint32_t>(in + 5),
                                   turbo::safe_load<uint32_t>(in + 5), turbo::safe_load<uint32_t>(in + 5)};
                shifts = simd_batch{8, 14, 20, 26};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 6;
                return in;
            }

            inline static const uint32_t *unpack7_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x7f;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 7-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{0, 7, 14, 21};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 7-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0) >> 28 | turbo::safe_load<uint32_t>(in + 1) << 4,
                                   turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{0, 3, 10, 17};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 7-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1) >> 31 | turbo::safe_load<uint32_t>(in + 2) << 1,
                                   turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2)};
                shifts = simd_batch{24, 0, 6, 13};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 7-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 2) >> 27 | turbo::safe_load<uint32_t>(in + 3) << 5,
                                   turbo::safe_load<uint32_t>(in + 3), turbo::safe_load<uint32_t>(in + 3)};
                shifts = simd_batch{20, 0, 2, 9};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 7-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3), turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3) >> 30 | turbo::safe_load<uint32_t>(in + 4) << 2,
                                   turbo::safe_load<uint32_t>(in + 4)};
                shifts = simd_batch{16, 23, 0, 5};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 7-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 4), turbo::safe_load<uint32_t>(in + 4),
                                   turbo::safe_load<uint32_t>(in + 4) >> 26 | turbo::safe_load<uint32_t>(in + 5) << 6,
                                   turbo::safe_load<uint32_t>(in + 5)};
                shifts = simd_batch{12, 19, 0, 1};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 7-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 5), turbo::safe_load<uint32_t>(in + 5),
                                   turbo::safe_load<uint32_t>(in + 5),
                                   turbo::safe_load<uint32_t>(in + 5) >> 29 | turbo::safe_load<uint32_t>(in + 6) << 3};
                shifts = simd_batch{8, 15, 22, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 7-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 6), turbo::safe_load<uint32_t>(in + 6),
                                   turbo::safe_load<uint32_t>(in + 6), turbo::safe_load<uint32_t>(in + 6)};
                shifts = simd_batch{4, 11, 18, 25};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 7;
                return in;
            }

            inline static const uint32_t *unpack8_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0xff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 8-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0)};
                shifts = simd_batch{0, 8, 16, 24};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 8-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{0, 8, 16, 24};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 8-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2)};
                shifts = simd_batch{0, 8, 16, 24};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 8-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3), turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3), turbo::safe_load<uint32_t>(in + 3)};
                shifts = simd_batch{0, 8, 16, 24};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 8-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 4), turbo::safe_load<uint32_t>(in + 4),
                                   turbo::safe_load<uint32_t>(in + 4), turbo::safe_load<uint32_t>(in + 4)};
                shifts = simd_batch{0, 8, 16, 24};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 8-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 5), turbo::safe_load<uint32_t>(in + 5),
                                   turbo::safe_load<uint32_t>(in + 5), turbo::safe_load<uint32_t>(in + 5)};
                shifts = simd_batch{0, 8, 16, 24};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 8-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 6), turbo::safe_load<uint32_t>(in + 6),
                                   turbo::safe_load<uint32_t>(in + 6), turbo::safe_load<uint32_t>(in + 6)};
                shifts = simd_batch{0, 8, 16, 24};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 8-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 7), turbo::safe_load<uint32_t>(in + 7),
                                   turbo::safe_load<uint32_t>(in + 7), turbo::safe_load<uint32_t>(in + 7)};
                shifts = simd_batch{0, 8, 16, 24};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 8;
                return in;
            }

            inline static const uint32_t *unpack9_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x1ff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 9-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 27 | turbo::safe_load<uint32_t>(in + 1) << 5};
                shifts = simd_batch{0, 9, 18, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 9-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1) >> 31 | turbo::safe_load<uint32_t>(in + 2) << 1};
                shifts = simd_batch{4, 13, 22, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 9-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 2) >> 26 | turbo::safe_load<uint32_t>(in + 3) << 6,
                                   turbo::safe_load<uint32_t>(in + 3)};
                shifts = simd_batch{8, 17, 0, 3};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 9-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3), turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3) >> 30 | turbo::safe_load<uint32_t>(in + 4) << 2,
                                   turbo::safe_load<uint32_t>(in + 4)};
                shifts = simd_batch{12, 21, 0, 7};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 9-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 4),
                                   turbo::safe_load<uint32_t>(in + 4) >> 25 | turbo::safe_load<uint32_t>(in + 5) << 7,
                                   turbo::safe_load<uint32_t>(in + 5), turbo::safe_load<uint32_t>(in + 5)};
                shifts = simd_batch{16, 0, 2, 11};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 9-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 5),
                                   turbo::safe_load<uint32_t>(in + 5) >> 29 | turbo::safe_load<uint32_t>(in + 6) << 3,
                                   turbo::safe_load<uint32_t>(in + 6), turbo::safe_load<uint32_t>(in + 6)};
                shifts = simd_batch{20, 0, 6, 15};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 9-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 6) >> 24 | turbo::safe_load<uint32_t>(in + 7) << 8,
                                   turbo::safe_load<uint32_t>(in + 7), turbo::safe_load<uint32_t>(in + 7),
                                   turbo::safe_load<uint32_t>(in + 7)};
                shifts = simd_batch{0, 1, 10, 19};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 9-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 7) >> 28 | turbo::safe_load<uint32_t>(in + 8) << 4,
                                   turbo::safe_load<uint32_t>(in + 8), turbo::safe_load<uint32_t>(in + 8),
                                   turbo::safe_load<uint32_t>(in + 8)};
                shifts = simd_batch{0, 5, 14, 23};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 9;
                return in;
            }

            inline static const uint32_t *unpack10_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x3ff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 10-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 30 | turbo::safe_load<uint32_t>(in + 1) << 2};
                shifts = simd_batch{0, 10, 20, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 10-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1) >> 28 | turbo::safe_load<uint32_t>(in + 2) << 4,
                                   turbo::safe_load<uint32_t>(in + 2)};
                shifts = simd_batch{8, 18, 0, 6};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 10-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 2) >> 26 | turbo::safe_load<uint32_t>(in + 3) << 6,
                                   turbo::safe_load<uint32_t>(in + 3), turbo::safe_load<uint32_t>(in + 3)};
                shifts = simd_batch{16, 0, 4, 14};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 10-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3) >> 24 | turbo::safe_load<uint32_t>(in + 4) << 8,
                                   turbo::safe_load<uint32_t>(in + 4), turbo::safe_load<uint32_t>(in + 4),
                                   turbo::safe_load<uint32_t>(in + 4)};
                shifts = simd_batch{0, 2, 12, 22};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 10-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 5), turbo::safe_load<uint32_t>(in + 5),
                                   turbo::safe_load<uint32_t>(in + 5),
                                   turbo::safe_load<uint32_t>(in + 5) >> 30 | turbo::safe_load<uint32_t>(in + 6) << 2};
                shifts = simd_batch{0, 10, 20, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 10-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 6), turbo::safe_load<uint32_t>(in + 6),
                                   turbo::safe_load<uint32_t>(in + 6) >> 28 | turbo::safe_load<uint32_t>(in + 7) << 4,
                                   turbo::safe_load<uint32_t>(in + 7)};
                shifts = simd_batch{8, 18, 0, 6};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 10-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 7),
                                   turbo::safe_load<uint32_t>(in + 7) >> 26 | turbo::safe_load<uint32_t>(in + 8) << 6,
                                   turbo::safe_load<uint32_t>(in + 8), turbo::safe_load<uint32_t>(in + 8)};
                shifts = simd_batch{16, 0, 4, 14};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 10-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 8) >> 24 | turbo::safe_load<uint32_t>(in + 9) << 8,
                                   turbo::safe_load<uint32_t>(in + 9), turbo::safe_load<uint32_t>(in + 9),
                                   turbo::safe_load<uint32_t>(in + 9)};
                shifts = simd_batch{0, 2, 12, 22};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 10;
                return in;
            }

            inline static const uint32_t *unpack11_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x7ff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 11-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 22 | turbo::safe_load<uint32_t>(in + 1) << 10,
                                   turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{0, 11, 0, 1};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 11-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1) >> 23 | turbo::safe_load<uint32_t>(in + 2) << 9,
                                   turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2)};
                shifts = simd_batch{12, 0, 2, 13};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 11-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2) >> 24 | turbo::safe_load<uint32_t>(in + 3) << 8,
                                   turbo::safe_load<uint32_t>(in + 3), turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3) >> 25 | turbo::safe_load<uint32_t>(in + 4) << 7};
                shifts = simd_batch{0, 3, 14, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 11-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 4), turbo::safe_load<uint32_t>(in + 4),
                                   turbo::safe_load<uint32_t>(in + 4) >> 26 | turbo::safe_load<uint32_t>(in + 5) << 6,
                                   turbo::safe_load<uint32_t>(in + 5)};
                shifts = simd_batch{4, 15, 0, 5};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 11-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 5),
                                   turbo::safe_load<uint32_t>(in + 5) >> 27 | turbo::safe_load<uint32_t>(in + 6) << 5,
                                   turbo::safe_load<uint32_t>(in + 6), turbo::safe_load<uint32_t>(in + 6)};
                shifts = simd_batch{16, 0, 6, 17};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 11-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 6) >> 28 | turbo::safe_load<uint32_t>(in + 7) << 4,
                                   turbo::safe_load<uint32_t>(in + 7), turbo::safe_load<uint32_t>(in + 7),
                                   turbo::safe_load<uint32_t>(in + 7) >> 29 | turbo::safe_load<uint32_t>(in + 8) << 3};
                shifts = simd_batch{0, 7, 18, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 11-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 8), turbo::safe_load<uint32_t>(in + 8),
                                   turbo::safe_load<uint32_t>(in + 8) >> 30 | turbo::safe_load<uint32_t>(in + 9) << 2,
                                   turbo::safe_load<uint32_t>(in + 9)};
                shifts = simd_batch{8, 19, 0, 9};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 11-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 9),
                                   turbo::safe_load<uint32_t>(in + 9) >> 31 | turbo::safe_load<uint32_t>(in + 10) << 1,
                                   turbo::safe_load<uint32_t>(in + 10), turbo::safe_load<uint32_t>(in + 10)};
                shifts = simd_batch{20, 0, 10, 21};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 11;
                return in;
            }

            inline static const uint32_t *unpack12_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0xfff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 12-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 24 | turbo::safe_load<uint32_t>(in + 1) << 8,
                                   turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{0, 12, 0, 4};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 12-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1) >> 28 | turbo::safe_load<uint32_t>(in + 2) << 4,
                                   turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2)};
                shifts = simd_batch{16, 0, 8, 20};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 12-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3), turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3) >> 24 | turbo::safe_load<uint32_t>(in + 4) << 8,
                                   turbo::safe_load<uint32_t>(in + 4)};
                shifts = simd_batch{0, 12, 0, 4};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 12-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 4),
                                   turbo::safe_load<uint32_t>(in + 4) >> 28 | turbo::safe_load<uint32_t>(in + 5) << 4,
                                   turbo::safe_load<uint32_t>(in + 5), turbo::safe_load<uint32_t>(in + 5)};
                shifts = simd_batch{16, 0, 8, 20};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 12-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 6), turbo::safe_load<uint32_t>(in + 6),
                                   turbo::safe_load<uint32_t>(in + 6) >> 24 | turbo::safe_load<uint32_t>(in + 7) << 8,
                                   turbo::safe_load<uint32_t>(in + 7)};
                shifts = simd_batch{0, 12, 0, 4};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 12-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 7),
                                   turbo::safe_load<uint32_t>(in + 7) >> 28 | turbo::safe_load<uint32_t>(in + 8) << 4,
                                   turbo::safe_load<uint32_t>(in + 8), turbo::safe_load<uint32_t>(in + 8)};
                shifts = simd_batch{16, 0, 8, 20};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 12-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 9), turbo::safe_load<uint32_t>(in + 9),
                                   turbo::safe_load<uint32_t>(in + 9) >> 24 | turbo::safe_load<uint32_t>(in + 10) << 8,
                                   turbo::safe_load<uint32_t>(in + 10)};
                shifts = simd_batch{0, 12, 0, 4};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 12-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 10),
                                   turbo::safe_load<uint32_t>(in + 10) >> 28 | turbo::safe_load<uint32_t>(in + 11) << 4,
                                   turbo::safe_load<uint32_t>(in + 11), turbo::safe_load<uint32_t>(in + 11)};
                shifts = simd_batch{16, 0, 8, 20};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 12;
                return in;
            }

            inline static const uint32_t *unpack13_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x1fff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 13-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 26 | turbo::safe_load<uint32_t>(in + 1) << 6,
                                   turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{0, 13, 0, 7};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 13-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1) >> 20 | turbo::safe_load<uint32_t>(in + 2) << 12,
                                   turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 2) >> 27 | turbo::safe_load<uint32_t>(in + 3) << 5};
                shifts = simd_batch{0, 1, 14, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 13-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3) >> 21 | turbo::safe_load<uint32_t>(in + 4) << 11,
                                   turbo::safe_load<uint32_t>(in + 4), turbo::safe_load<uint32_t>(in + 4)};
                shifts = simd_batch{8, 0, 2, 15};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 13-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 4) >> 28 | turbo::safe_load<uint32_t>(in + 5) << 4,
                                   turbo::safe_load<uint32_t>(in + 5),
                                   turbo::safe_load<uint32_t>(in + 5) >> 22 | turbo::safe_load<uint32_t>(in + 6) << 10,
                                   turbo::safe_load<uint32_t>(in + 6)};
                shifts = simd_batch{0, 9, 0, 3};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 13-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 6),
                                   turbo::safe_load<uint32_t>(in + 6) >> 29 | turbo::safe_load<uint32_t>(in + 7) << 3,
                                   turbo::safe_load<uint32_t>(in + 7),
                                   turbo::safe_load<uint32_t>(in + 7) >> 23 | turbo::safe_load<uint32_t>(in + 8) << 9};
                shifts = simd_batch{16, 0, 10, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 13-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 8), turbo::safe_load<uint32_t>(in + 8),
                                   turbo::safe_load<uint32_t>(in + 8) >> 30 | turbo::safe_load<uint32_t>(in + 9) << 2,
                                   turbo::safe_load<uint32_t>(in + 9)};
                shifts = simd_batch{4, 17, 0, 11};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 13-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 9) >> 24 | turbo::safe_load<uint32_t>(in + 10) << 8,
                                   turbo::safe_load<uint32_t>(in + 10), turbo::safe_load<uint32_t>(in + 10),
                                   turbo::safe_load<uint32_t>(in + 10) >> 31 |
                                   turbo::safe_load<uint32_t>(in + 11) << 1};
                shifts = simd_batch{0, 5, 18, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 13-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 11),
                                   turbo::safe_load<uint32_t>(in + 11) >> 25 | turbo::safe_load<uint32_t>(in + 12) << 7,
                                   turbo::safe_load<uint32_t>(in + 12), turbo::safe_load<uint32_t>(in + 12)};
                shifts = simd_batch{12, 0, 6, 19};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 13;
                return in;
            }

            inline static const uint32_t *unpack14_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x3fff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 14-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 28 | turbo::safe_load<uint32_t>(in + 1) << 4,
                                   turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{0, 14, 0, 10};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 14-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1) >> 24 | turbo::safe_load<uint32_t>(in + 2) << 8,
                                   turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 2) >> 20 | turbo::safe_load<uint32_t>(in + 3) << 12,
                                   turbo::safe_load<uint32_t>(in + 3)};
                shifts = simd_batch{0, 6, 0, 2};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 14-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3) >> 30 | turbo::safe_load<uint32_t>(in + 4) << 2,
                                   turbo::safe_load<uint32_t>(in + 4),
                                   turbo::safe_load<uint32_t>(in + 4) >> 26 | turbo::safe_load<uint32_t>(in + 5) << 6};
                shifts = simd_batch{16, 0, 12, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 14-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 5),
                                   turbo::safe_load<uint32_t>(in + 5) >> 22 | turbo::safe_load<uint32_t>(in + 6) << 10,
                                   turbo::safe_load<uint32_t>(in + 6), turbo::safe_load<uint32_t>(in + 6)};
                shifts = simd_batch{8, 0, 4, 18};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 14-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 7), turbo::safe_load<uint32_t>(in + 7),
                                   turbo::safe_load<uint32_t>(in + 7) >> 28 | turbo::safe_load<uint32_t>(in + 8) << 4,
                                   turbo::safe_load<uint32_t>(in + 8)};
                shifts = simd_batch{0, 14, 0, 10};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 14-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 8) >> 24 | turbo::safe_load<uint32_t>(in + 9) << 8,
                                   turbo::safe_load<uint32_t>(in + 9),
                                   turbo::safe_load<uint32_t>(in + 9) >> 20 | turbo::safe_load<uint32_t>(in + 10) << 12,
                                   turbo::safe_load<uint32_t>(in + 10)};
                shifts = simd_batch{0, 6, 0, 2};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 14-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 10),
                                   turbo::safe_load<uint32_t>(in + 10) >> 30 | turbo::safe_load<uint32_t>(in + 11) << 2,
                                   turbo::safe_load<uint32_t>(in + 11), turbo::safe_load<uint32_t>(in + 11) >> 26 |
                                                                        turbo::safe_load<uint32_t>(in + 12) << 6};
                shifts = simd_batch{16, 0, 12, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 14-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 12), turbo::safe_load<uint32_t>(in + 12) >> 22 |
                                                                        turbo::safe_load<uint32_t>(in + 13) << 10,
                                   turbo::safe_load<uint32_t>(in + 13), turbo::safe_load<uint32_t>(in + 13)};
                shifts = simd_batch{8, 0, 4, 18};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 14;
                return in;
            }

            inline static const uint32_t *unpack15_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x7fff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 15-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 30 | turbo::safe_load<uint32_t>(in + 1) << 2,
                                   turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{0, 15, 0, 13};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 15-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 1) >> 28 | turbo::safe_load<uint32_t>(in + 2) << 4,
                                   turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 2) >> 26 | turbo::safe_load<uint32_t>(in + 3) << 6,
                                   turbo::safe_load<uint32_t>(in + 3)};
                shifts = simd_batch{0, 11, 0, 9};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 15-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3) >> 24 | turbo::safe_load<uint32_t>(in + 4) << 8,
                                   turbo::safe_load<uint32_t>(in + 4),
                                   turbo::safe_load<uint32_t>(in + 4) >> 22 | turbo::safe_load<uint32_t>(in + 5) << 10,
                                   turbo::safe_load<uint32_t>(in + 5)};
                shifts = simd_batch{0, 7, 0, 5};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 15-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 5) >> 20 | turbo::safe_load<uint32_t>(in + 6) << 12,
                                   turbo::safe_load<uint32_t>(in + 6),
                                   turbo::safe_load<uint32_t>(in + 6) >> 18 | turbo::safe_load<uint32_t>(in + 7) << 14,
                                   turbo::safe_load<uint32_t>(in + 7)};
                shifts = simd_batch{0, 3, 0, 1};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 15-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 7),
                                   turbo::safe_load<uint32_t>(in + 7) >> 31 | turbo::safe_load<uint32_t>(in + 8) << 1,
                                   turbo::safe_load<uint32_t>(in + 8),
                                   turbo::safe_load<uint32_t>(in + 8) >> 29 | turbo::safe_load<uint32_t>(in + 9) << 3};
                shifts = simd_batch{16, 0, 14, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 15-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 9),
                                   turbo::safe_load<uint32_t>(in + 9) >> 27 | turbo::safe_load<uint32_t>(in + 10) << 5,
                                   turbo::safe_load<uint32_t>(in + 10), turbo::safe_load<uint32_t>(in + 10) >> 25 |
                                                                        turbo::safe_load<uint32_t>(in + 11) << 7};
                shifts = simd_batch{12, 0, 10, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 15-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 11),
                                   turbo::safe_load<uint32_t>(in + 11) >> 23 | turbo::safe_load<uint32_t>(in + 12) << 9,
                                   turbo::safe_load<uint32_t>(in + 12), turbo::safe_load<uint32_t>(in + 12) >> 21 |
                                                                        turbo::safe_load<uint32_t>(in + 13) << 11};
                shifts = simd_batch{8, 0, 6, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 15-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 13), turbo::safe_load<uint32_t>(in + 13) >> 19 |
                                                                        turbo::safe_load<uint32_t>(in + 14) << 13,
                                   turbo::safe_load<uint32_t>(in + 14), turbo::safe_load<uint32_t>(in + 14)};
                shifts = simd_batch{4, 0, 2, 17};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 15;
                return in;
            }

            inline static const uint32_t *unpack16_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0xffff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 16-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0), turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 1), turbo::safe_load<uint32_t>(in + 1)};
                shifts = simd_batch{0, 16, 0, 16};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 16-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2), turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 3), turbo::safe_load<uint32_t>(in + 3)};
                shifts = simd_batch{0, 16, 0, 16};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 16-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 4), turbo::safe_load<uint32_t>(in + 4),
                                   turbo::safe_load<uint32_t>(in + 5), turbo::safe_load<uint32_t>(in + 5)};
                shifts = simd_batch{0, 16, 0, 16};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 16-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 6), turbo::safe_load<uint32_t>(in + 6),
                                   turbo::safe_load<uint32_t>(in + 7), turbo::safe_load<uint32_t>(in + 7)};
                shifts = simd_batch{0, 16, 0, 16};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 16-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 8), turbo::safe_load<uint32_t>(in + 8),
                                   turbo::safe_load<uint32_t>(in + 9), turbo::safe_load<uint32_t>(in + 9)};
                shifts = simd_batch{0, 16, 0, 16};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 16-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 10), turbo::safe_load<uint32_t>(in + 10),
                                   turbo::safe_load<uint32_t>(in + 11), turbo::safe_load<uint32_t>(in + 11)};
                shifts = simd_batch{0, 16, 0, 16};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 16-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 12), turbo::safe_load<uint32_t>(in + 12),
                                   turbo::safe_load<uint32_t>(in + 13), turbo::safe_load<uint32_t>(in + 13)};
                shifts = simd_batch{0, 16, 0, 16};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 16-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 14), turbo::safe_load<uint32_t>(in + 14),
                                   turbo::safe_load<uint32_t>(in + 15), turbo::safe_load<uint32_t>(in + 15)};
                shifts = simd_batch{0, 16, 0, 16};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 16;
                return in;
            }

            inline static const uint32_t *unpack17_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x1ffff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 17-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 17 | turbo::safe_load<uint32_t>(in + 1) << 15,
                                   turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1) >> 19 | turbo::safe_load<uint32_t>(in + 2) << 13};
                shifts = simd_batch{0, 0, 2, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 17-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 2) >> 21 | turbo::safe_load<uint32_t>(in + 3) << 11,
                                   turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3) >> 23 | turbo::safe_load<uint32_t>(in + 4) << 9};
                shifts = simd_batch{4, 0, 6, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 17-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 4),
                                   turbo::safe_load<uint32_t>(in + 4) >> 25 | turbo::safe_load<uint32_t>(in + 5) << 7,
                                   turbo::safe_load<uint32_t>(in + 5),
                                   turbo::safe_load<uint32_t>(in + 5) >> 27 | turbo::safe_load<uint32_t>(in + 6) << 5};
                shifts = simd_batch{8, 0, 10, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 17-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 6),
                                   turbo::safe_load<uint32_t>(in + 6) >> 29 | turbo::safe_load<uint32_t>(in + 7) << 3,
                                   turbo::safe_load<uint32_t>(in + 7),
                                   turbo::safe_load<uint32_t>(in + 7) >> 31 | turbo::safe_load<uint32_t>(in + 8) << 1};
                shifts = simd_batch{12, 0, 14, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 17-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 8) >> 16 | turbo::safe_load<uint32_t>(in + 9) << 16,
                                   turbo::safe_load<uint32_t>(in + 9),
                                   turbo::safe_load<uint32_t>(in + 9) >> 18 | turbo::safe_load<uint32_t>(in + 10) << 14,
                                   turbo::safe_load<uint32_t>(in + 10)};
                shifts = simd_batch{0, 1, 0, 3};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 17-bit bundles 20 to 23
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 10) >> 20 | turbo::safe_load<uint32_t>(in + 11) << 12,
                        turbo::safe_load<uint32_t>(in + 11),
                        turbo::safe_load<uint32_t>(in + 11) >> 22 | turbo::safe_load<uint32_t>(in + 12) << 10,
                        turbo::safe_load<uint32_t>(in + 12)};
                shifts = simd_batch{0, 5, 0, 7};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 17-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 12) >> 24 | turbo::safe_load<uint32_t>(in + 13) << 8,
                                   turbo::safe_load<uint32_t>(in + 13),
                                   turbo::safe_load<uint32_t>(in + 13) >> 26 | turbo::safe_load<uint32_t>(in + 14) << 6,
                                   turbo::safe_load<uint32_t>(in + 14)};
                shifts = simd_batch{0, 9, 0, 11};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 17-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 14) >> 28 | turbo::safe_load<uint32_t>(in + 15) << 4,
                                   turbo::safe_load<uint32_t>(in + 15),
                                   turbo::safe_load<uint32_t>(in + 15) >> 30 | turbo::safe_load<uint32_t>(in + 16) << 2,
                                   turbo::safe_load<uint32_t>(in + 16)};
                shifts = simd_batch{0, 13, 0, 15};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 17;
                return in;
            }

            inline static const uint32_t *unpack18_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x3ffff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 18-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 18 | turbo::safe_load<uint32_t>(in + 1) << 14,
                                   turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1) >> 22 | turbo::safe_load<uint32_t>(in + 2) << 10};
                shifts = simd_batch{0, 0, 4, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 18-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 2) >> 26 | turbo::safe_load<uint32_t>(in + 3) << 6,
                                   turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3) >> 30 | turbo::safe_load<uint32_t>(in + 4) << 2};
                shifts = simd_batch{8, 0, 12, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 18-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 4) >> 16 | turbo::safe_load<uint32_t>(in + 5) << 16,
                                   turbo::safe_load<uint32_t>(in + 5),
                                   turbo::safe_load<uint32_t>(in + 5) >> 20 | turbo::safe_load<uint32_t>(in + 6) << 12,
                                   turbo::safe_load<uint32_t>(in + 6)};
                shifts = simd_batch{0, 2, 0, 6};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 18-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 6) >> 24 | turbo::safe_load<uint32_t>(in + 7) << 8,
                                   turbo::safe_load<uint32_t>(in + 7),
                                   turbo::safe_load<uint32_t>(in + 7) >> 28 | turbo::safe_load<uint32_t>(in + 8) << 4,
                                   turbo::safe_load<uint32_t>(in + 8)};
                shifts = simd_batch{0, 10, 0, 14};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 18-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 9),
                                   turbo::safe_load<uint32_t>(in + 9) >> 18 | turbo::safe_load<uint32_t>(in + 10) << 14,
                                   turbo::safe_load<uint32_t>(in + 10), turbo::safe_load<uint32_t>(in + 10) >> 22 |
                                                                        turbo::safe_load<uint32_t>(in + 11) << 10};
                shifts = simd_batch{0, 0, 4, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 18-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 11),
                                   turbo::safe_load<uint32_t>(in + 11) >> 26 | turbo::safe_load<uint32_t>(in + 12) << 6,
                                   turbo::safe_load<uint32_t>(in + 12), turbo::safe_load<uint32_t>(in + 12) >> 30 |
                                                                        turbo::safe_load<uint32_t>(in + 13) << 2};
                shifts = simd_batch{8, 0, 12, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 18-bit bundles 24 to 27
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 13) >> 16 | turbo::safe_load<uint32_t>(in + 14) << 16,
                        turbo::safe_load<uint32_t>(in + 14),
                        turbo::safe_load<uint32_t>(in + 14) >> 20 | turbo::safe_load<uint32_t>(in + 15) << 12,
                        turbo::safe_load<uint32_t>(in + 15)};
                shifts = simd_batch{0, 2, 0, 6};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 18-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 15) >> 24 | turbo::safe_load<uint32_t>(in + 16) << 8,
                                   turbo::safe_load<uint32_t>(in + 16),
                                   turbo::safe_load<uint32_t>(in + 16) >> 28 | turbo::safe_load<uint32_t>(in + 17) << 4,
                                   turbo::safe_load<uint32_t>(in + 17)};
                shifts = simd_batch{0, 10, 0, 14};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 18;
                return in;
            }

            inline static const uint32_t *unpack19_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x7ffff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 19-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 19 | turbo::safe_load<uint32_t>(in + 1) << 13,
                                   turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1) >> 25 | turbo::safe_load<uint32_t>(in + 2) << 7};
                shifts = simd_batch{0, 0, 6, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 19-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2),
                                   turbo::safe_load<uint32_t>(in + 2) >> 31 | turbo::safe_load<uint32_t>(in + 3) << 1,
                                   turbo::safe_load<uint32_t>(in + 3) >> 18 | turbo::safe_load<uint32_t>(in + 4) << 14,
                                   turbo::safe_load<uint32_t>(in + 4)};
                shifts = simd_batch{12, 0, 0, 5};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 19-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 4) >> 24 | turbo::safe_load<uint32_t>(in + 5) << 8,
                                   turbo::safe_load<uint32_t>(in + 5),
                                   turbo::safe_load<uint32_t>(in + 5) >> 30 | turbo::safe_load<uint32_t>(in + 6) << 2,
                                   turbo::safe_load<uint32_t>(in + 6) >> 17 | turbo::safe_load<uint32_t>(in + 7) << 15};
                shifts = simd_batch{0, 11, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 19-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 7),
                                   turbo::safe_load<uint32_t>(in + 7) >> 23 | turbo::safe_load<uint32_t>(in + 8) << 9,
                                   turbo::safe_load<uint32_t>(in + 8),
                                   turbo::safe_load<uint32_t>(in + 8) >> 29 | turbo::safe_load<uint32_t>(in + 9) << 3};
                shifts = simd_batch{4, 0, 10, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 19-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 9) >> 16 | turbo::safe_load<uint32_t>(in + 10) << 16,
                                   turbo::safe_load<uint32_t>(in + 10), turbo::safe_load<uint32_t>(in + 10) >> 22 |
                                                                        turbo::safe_load<uint32_t>(in + 11) << 10,
                                   turbo::safe_load<uint32_t>(in + 11)};
                shifts = simd_batch{0, 3, 0, 9};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 19-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 11) >> 28 | turbo::safe_load<uint32_t>(in + 12) << 4,
                                   turbo::safe_load<uint32_t>(in + 12) >> 15 |
                                   turbo::safe_load<uint32_t>(in + 13) << 17, turbo::safe_load<uint32_t>(in + 13),
                                   turbo::safe_load<uint32_t>(in + 13) >> 21 |
                                   turbo::safe_load<uint32_t>(in + 14) << 11};
                shifts = simd_batch{0, 0, 2, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 19-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 14),
                                   turbo::safe_load<uint32_t>(in + 14) >> 27 | turbo::safe_load<uint32_t>(in + 15) << 5,
                                   turbo::safe_load<uint32_t>(in + 15) >> 14 |
                                   turbo::safe_load<uint32_t>(in + 16) << 18, turbo::safe_load<uint32_t>(in + 16)};
                shifts = simd_batch{8, 0, 0, 1};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 19-bit bundles 28 to 31
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 16) >> 20 | turbo::safe_load<uint32_t>(in + 17) << 12,
                        turbo::safe_load<uint32_t>(in + 17),
                        turbo::safe_load<uint32_t>(in + 17) >> 26 | turbo::safe_load<uint32_t>(in + 18) << 6,
                        turbo::safe_load<uint32_t>(in + 18)};
                shifts = simd_batch{0, 7, 0, 13};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 19;
                return in;
            }

            inline static const uint32_t *unpack20_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0xfffff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 20-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 20 | turbo::safe_load<uint32_t>(in + 1) << 12,
                                   turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1) >> 28 | turbo::safe_load<uint32_t>(in + 2) << 4};
                shifts = simd_batch{0, 0, 8, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 20-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2) >> 16 | turbo::safe_load<uint32_t>(in + 3) << 16,
                                   turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3) >> 24 | turbo::safe_load<uint32_t>(in + 4) << 8,
                                   turbo::safe_load<uint32_t>(in + 4)};
                shifts = simd_batch{0, 4, 0, 12};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 20-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 5),
                                   turbo::safe_load<uint32_t>(in + 5) >> 20 | turbo::safe_load<uint32_t>(in + 6) << 12,
                                   turbo::safe_load<uint32_t>(in + 6),
                                   turbo::safe_load<uint32_t>(in + 6) >> 28 | turbo::safe_load<uint32_t>(in + 7) << 4};
                shifts = simd_batch{0, 0, 8, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 20-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 7) >> 16 | turbo::safe_load<uint32_t>(in + 8) << 16,
                                   turbo::safe_load<uint32_t>(in + 8),
                                   turbo::safe_load<uint32_t>(in + 8) >> 24 | turbo::safe_load<uint32_t>(in + 9) << 8,
                                   turbo::safe_load<uint32_t>(in + 9)};
                shifts = simd_batch{0, 4, 0, 12};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 20-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 10), turbo::safe_load<uint32_t>(in + 10) >> 20 |
                                                                        turbo::safe_load<uint32_t>(in + 11) << 12,
                                   turbo::safe_load<uint32_t>(in + 11), turbo::safe_load<uint32_t>(in + 11) >> 28 |
                                                                        turbo::safe_load<uint32_t>(in + 12) << 4};
                shifts = simd_batch{0, 0, 8, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 20-bit bundles 20 to 23
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 12) >> 16 | turbo::safe_load<uint32_t>(in + 13) << 16,
                        turbo::safe_load<uint32_t>(in + 13),
                        turbo::safe_load<uint32_t>(in + 13) >> 24 | turbo::safe_load<uint32_t>(in + 14) << 8,
                        turbo::safe_load<uint32_t>(in + 14)};
                shifts = simd_batch{0, 4, 0, 12};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 20-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 15), turbo::safe_load<uint32_t>(in + 15) >> 20 |
                                                                        turbo::safe_load<uint32_t>(in + 16) << 12,
                                   turbo::safe_load<uint32_t>(in + 16), turbo::safe_load<uint32_t>(in + 16) >> 28 |
                                                                        turbo::safe_load<uint32_t>(in + 17) << 4};
                shifts = simd_batch{0, 0, 8, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 20-bit bundles 28 to 31
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 17) >> 16 | turbo::safe_load<uint32_t>(in + 18) << 16,
                        turbo::safe_load<uint32_t>(in + 18),
                        turbo::safe_load<uint32_t>(in + 18) >> 24 | turbo::safe_load<uint32_t>(in + 19) << 8,
                        turbo::safe_load<uint32_t>(in + 19)};
                shifts = simd_batch{0, 4, 0, 12};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 20;
                return in;
            }

            inline static const uint32_t *unpack21_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x1fffff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 21-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 21 | turbo::safe_load<uint32_t>(in + 1) << 11,
                                   turbo::safe_load<uint32_t>(in + 1),
                                   turbo::safe_load<uint32_t>(in + 1) >> 31 | turbo::safe_load<uint32_t>(in + 2) << 1};
                shifts = simd_batch{0, 0, 10, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 21-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2) >> 20 | turbo::safe_load<uint32_t>(in + 3) << 12,
                                   turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3) >> 30 | turbo::safe_load<uint32_t>(in + 4) << 2,
                                   turbo::safe_load<uint32_t>(in + 4) >> 19 | turbo::safe_load<uint32_t>(in + 5) << 13};
                shifts = simd_batch{0, 9, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 21-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 5),
                                   turbo::safe_load<uint32_t>(in + 5) >> 29 | turbo::safe_load<uint32_t>(in + 6) << 3,
                                   turbo::safe_load<uint32_t>(in + 6) >> 18 | turbo::safe_load<uint32_t>(in + 7) << 14,
                                   turbo::safe_load<uint32_t>(in + 7)};
                shifts = simd_batch{8, 0, 0, 7};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 21-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 7) >> 28 | turbo::safe_load<uint32_t>(in + 8) << 4,
                                   turbo::safe_load<uint32_t>(in + 8) >> 17 | turbo::safe_load<uint32_t>(in + 9) << 15,
                                   turbo::safe_load<uint32_t>(in + 9),
                                   turbo::safe_load<uint32_t>(in + 9) >> 27 | turbo::safe_load<uint32_t>(in + 10) << 5};
                shifts = simd_batch{0, 0, 6, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 21-bit bundles 16 to 19
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 10) >> 16 | turbo::safe_load<uint32_t>(in + 11) << 16,
                        turbo::safe_load<uint32_t>(in + 11),
                        turbo::safe_load<uint32_t>(in + 11) >> 26 | turbo::safe_load<uint32_t>(in + 12) << 6,
                        turbo::safe_load<uint32_t>(in + 12) >> 15 | turbo::safe_load<uint32_t>(in + 13) << 17};
                shifts = simd_batch{0, 5, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 21-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 13),
                                   turbo::safe_load<uint32_t>(in + 13) >> 25 | turbo::safe_load<uint32_t>(in + 14) << 7,
                                   turbo::safe_load<uint32_t>(in + 14) >> 14 |
                                   turbo::safe_load<uint32_t>(in + 15) << 18, turbo::safe_load<uint32_t>(in + 15)};
                shifts = simd_batch{4, 0, 0, 3};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 21-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 15) >> 24 | turbo::safe_load<uint32_t>(in + 16) << 8,
                                   turbo::safe_load<uint32_t>(in + 16) >> 13 |
                                   turbo::safe_load<uint32_t>(in + 17) << 19, turbo::safe_load<uint32_t>(in + 17),
                                   turbo::safe_load<uint32_t>(in + 17) >> 23 |
                                   turbo::safe_load<uint32_t>(in + 18) << 9};
                shifts = simd_batch{0, 0, 2, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 21-bit bundles 28 to 31
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 18) >> 12 | turbo::safe_load<uint32_t>(in + 19) << 20,
                        turbo::safe_load<uint32_t>(in + 19),
                        turbo::safe_load<uint32_t>(in + 19) >> 22 | turbo::safe_load<uint32_t>(in + 20) << 10,
                        turbo::safe_load<uint32_t>(in + 20)};
                shifts = simd_batch{0, 1, 0, 11};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 21;
                return in;
            }

            inline static const uint32_t *unpack22_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x3fffff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 22-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 22 | turbo::safe_load<uint32_t>(in + 1) << 10,
                                   turbo::safe_load<uint32_t>(in + 1) >> 12 | turbo::safe_load<uint32_t>(in + 2) << 20,
                                   turbo::safe_load<uint32_t>(in + 2)};
                shifts = simd_batch{0, 0, 0, 2};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 22-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2) >> 24 | turbo::safe_load<uint32_t>(in + 3) << 8,
                                   turbo::safe_load<uint32_t>(in + 3) >> 14 | turbo::safe_load<uint32_t>(in + 4) << 18,
                                   turbo::safe_load<uint32_t>(in + 4),
                                   turbo::safe_load<uint32_t>(in + 4) >> 26 | turbo::safe_load<uint32_t>(in + 5) << 6};
                shifts = simd_batch{0, 0, 4, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 22-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 5) >> 16 | turbo::safe_load<uint32_t>(in + 6) << 16,
                                   turbo::safe_load<uint32_t>(in + 6),
                                   turbo::safe_load<uint32_t>(in + 6) >> 28 | turbo::safe_load<uint32_t>(in + 7) << 4,
                                   turbo::safe_load<uint32_t>(in + 7) >> 18 | turbo::safe_load<uint32_t>(in + 8) << 14};
                shifts = simd_batch{0, 6, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 22-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 8),
                                   turbo::safe_load<uint32_t>(in + 8) >> 30 | turbo::safe_load<uint32_t>(in + 9) << 2,
                                   turbo::safe_load<uint32_t>(in + 9) >> 20 | turbo::safe_load<uint32_t>(in + 10) << 12,
                                   turbo::safe_load<uint32_t>(in + 10)};
                shifts = simd_batch{8, 0, 0, 10};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 22-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 11), turbo::safe_load<uint32_t>(in + 11) >> 22 |
                                                                        turbo::safe_load<uint32_t>(in + 12) << 10,
                                   turbo::safe_load<uint32_t>(in + 12) >> 12 |
                                   turbo::safe_load<uint32_t>(in + 13) << 20, turbo::safe_load<uint32_t>(in + 13)};
                shifts = simd_batch{0, 0, 0, 2};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 22-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 13) >> 24 | turbo::safe_load<uint32_t>(in + 14) << 8,
                                   turbo::safe_load<uint32_t>(in + 14) >> 14 |
                                   turbo::safe_load<uint32_t>(in + 15) << 18, turbo::safe_load<uint32_t>(in + 15),
                                   turbo::safe_load<uint32_t>(in + 15) >> 26 |
                                   turbo::safe_load<uint32_t>(in + 16) << 6};
                shifts = simd_batch{0, 0, 4, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 22-bit bundles 24 to 27
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 16) >> 16 | turbo::safe_load<uint32_t>(in + 17) << 16,
                        turbo::safe_load<uint32_t>(in + 17),
                        turbo::safe_load<uint32_t>(in + 17) >> 28 | turbo::safe_load<uint32_t>(in + 18) << 4,
                        turbo::safe_load<uint32_t>(in + 18) >> 18 | turbo::safe_load<uint32_t>(in + 19) << 14};
                shifts = simd_batch{0, 6, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 22-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 19),
                                   turbo::safe_load<uint32_t>(in + 19) >> 30 | turbo::safe_load<uint32_t>(in + 20) << 2,
                                   turbo::safe_load<uint32_t>(in + 20) >> 20 |
                                   turbo::safe_load<uint32_t>(in + 21) << 12, turbo::safe_load<uint32_t>(in + 21)};
                shifts = simd_batch{8, 0, 0, 10};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 22;
                return in;
            }

            inline static const uint32_t *unpack23_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x7fffff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 23-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 23 | turbo::safe_load<uint32_t>(in + 1) << 9,
                                   turbo::safe_load<uint32_t>(in + 1) >> 14 | turbo::safe_load<uint32_t>(in + 2) << 18,
                                   turbo::safe_load<uint32_t>(in + 2)};
                shifts = simd_batch{0, 0, 0, 5};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 23-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 2) >> 28 | turbo::safe_load<uint32_t>(in + 3) << 4,
                                   turbo::safe_load<uint32_t>(in + 3) >> 19 | turbo::safe_load<uint32_t>(in + 4) << 13,
                                   turbo::safe_load<uint32_t>(in + 4) >> 10 | turbo::safe_load<uint32_t>(in + 5) << 22,
                                   turbo::safe_load<uint32_t>(in + 5)};
                shifts = simd_batch{0, 0, 0, 1};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 23-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 5) >> 24 | turbo::safe_load<uint32_t>(in + 6) << 8,
                                   turbo::safe_load<uint32_t>(in + 6) >> 15 | turbo::safe_load<uint32_t>(in + 7) << 17,
                                   turbo::safe_load<uint32_t>(in + 7),
                                   turbo::safe_load<uint32_t>(in + 7) >> 29 | turbo::safe_load<uint32_t>(in + 8) << 3};
                shifts = simd_batch{0, 0, 6, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 23-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 8) >> 20 | turbo::safe_load<uint32_t>(in + 9) << 12,
                                   turbo::safe_load<uint32_t>(in + 9) >> 11 | turbo::safe_load<uint32_t>(in + 10) << 21,
                                   turbo::safe_load<uint32_t>(in + 10), turbo::safe_load<uint32_t>(in + 10) >> 25 |
                                                                        turbo::safe_load<uint32_t>(in + 11) << 7};
                shifts = simd_batch{0, 0, 2, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 23-bit bundles 16 to 19
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 11) >> 16 | turbo::safe_load<uint32_t>(in + 12) << 16,
                        turbo::safe_load<uint32_t>(in + 12),
                        turbo::safe_load<uint32_t>(in + 12) >> 30 | turbo::safe_load<uint32_t>(in + 13) << 2,
                        turbo::safe_load<uint32_t>(in + 13) >> 21 | turbo::safe_load<uint32_t>(in + 14) << 11};
                shifts = simd_batch{0, 7, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 23-bit bundles 20 to 23
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 14) >> 12 | turbo::safe_load<uint32_t>(in + 15) << 20,
                        turbo::safe_load<uint32_t>(in + 15),
                        turbo::safe_load<uint32_t>(in + 15) >> 26 | turbo::safe_load<uint32_t>(in + 16) << 6,
                        turbo::safe_load<uint32_t>(in + 16) >> 17 | turbo::safe_load<uint32_t>(in + 17) << 15};
                shifts = simd_batch{0, 3, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 23-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 17),
                                   turbo::safe_load<uint32_t>(in + 17) >> 31 | turbo::safe_load<uint32_t>(in + 18) << 1,
                                   turbo::safe_load<uint32_t>(in + 18) >> 22 |
                                   turbo::safe_load<uint32_t>(in + 19) << 10,
                                   turbo::safe_load<uint32_t>(in + 19) >> 13 |
                                   turbo::safe_load<uint32_t>(in + 20) << 19};
                shifts = simd_batch{8, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 23-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 20),
                                   turbo::safe_load<uint32_t>(in + 20) >> 27 | turbo::safe_load<uint32_t>(in + 21) << 5,
                                   turbo::safe_load<uint32_t>(in + 21) >> 18 |
                                   turbo::safe_load<uint32_t>(in + 22) << 14, turbo::safe_load<uint32_t>(in + 22)};
                shifts = simd_batch{4, 0, 0, 9};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 23;
                return in;
            }

            inline static const uint32_t *unpack24_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0xffffff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 24-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 24 | turbo::safe_load<uint32_t>(in + 1) << 8,
                                   turbo::safe_load<uint32_t>(in + 1) >> 16 | turbo::safe_load<uint32_t>(in + 2) << 16,
                                   turbo::safe_load<uint32_t>(in + 2)};
                shifts = simd_batch{0, 0, 0, 8};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 24-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3) >> 24 | turbo::safe_load<uint32_t>(in + 4) << 8,
                                   turbo::safe_load<uint32_t>(in + 4) >> 16 | turbo::safe_load<uint32_t>(in + 5) << 16,
                                   turbo::safe_load<uint32_t>(in + 5)};
                shifts = simd_batch{0, 0, 0, 8};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 24-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 6),
                                   turbo::safe_load<uint32_t>(in + 6) >> 24 | turbo::safe_load<uint32_t>(in + 7) << 8,
                                   turbo::safe_load<uint32_t>(in + 7) >> 16 | turbo::safe_load<uint32_t>(in + 8) << 16,
                                   turbo::safe_load<uint32_t>(in + 8)};
                shifts = simd_batch{0, 0, 0, 8};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 24-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 9),
                                   turbo::safe_load<uint32_t>(in + 9) >> 24 | turbo::safe_load<uint32_t>(in + 10) << 8,
                                   turbo::safe_load<uint32_t>(in + 10) >> 16 |
                                   turbo::safe_load<uint32_t>(in + 11) << 16, turbo::safe_load<uint32_t>(in + 11)};
                shifts = simd_batch{0, 0, 0, 8};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 24-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 12),
                                   turbo::safe_load<uint32_t>(in + 12) >> 24 | turbo::safe_load<uint32_t>(in + 13) << 8,
                                   turbo::safe_load<uint32_t>(in + 13) >> 16 |
                                   turbo::safe_load<uint32_t>(in + 14) << 16, turbo::safe_load<uint32_t>(in + 14)};
                shifts = simd_batch{0, 0, 0, 8};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 24-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 15),
                                   turbo::safe_load<uint32_t>(in + 15) >> 24 | turbo::safe_load<uint32_t>(in + 16) << 8,
                                   turbo::safe_load<uint32_t>(in + 16) >> 16 |
                                   turbo::safe_load<uint32_t>(in + 17) << 16, turbo::safe_load<uint32_t>(in + 17)};
                shifts = simd_batch{0, 0, 0, 8};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 24-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 18),
                                   turbo::safe_load<uint32_t>(in + 18) >> 24 | turbo::safe_load<uint32_t>(in + 19) << 8,
                                   turbo::safe_load<uint32_t>(in + 19) >> 16 |
                                   turbo::safe_load<uint32_t>(in + 20) << 16, turbo::safe_load<uint32_t>(in + 20)};
                shifts = simd_batch{0, 0, 0, 8};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 24-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 21),
                                   turbo::safe_load<uint32_t>(in + 21) >> 24 | turbo::safe_load<uint32_t>(in + 22) << 8,
                                   turbo::safe_load<uint32_t>(in + 22) >> 16 |
                                   turbo::safe_load<uint32_t>(in + 23) << 16, turbo::safe_load<uint32_t>(in + 23)};
                shifts = simd_batch{0, 0, 0, 8};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 24;
                return in;
            }

            inline static const uint32_t *unpack25_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x1ffffff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 25-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 25 | turbo::safe_load<uint32_t>(in + 1) << 7,
                                   turbo::safe_load<uint32_t>(in + 1) >> 18 | turbo::safe_load<uint32_t>(in + 2) << 14,
                                   turbo::safe_load<uint32_t>(in + 2) >> 11 | turbo::safe_load<uint32_t>(in + 3) << 21};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 25-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3),
                                   turbo::safe_load<uint32_t>(in + 3) >> 29 | turbo::safe_load<uint32_t>(in + 4) << 3,
                                   turbo::safe_load<uint32_t>(in + 4) >> 22 | turbo::safe_load<uint32_t>(in + 5) << 10,
                                   turbo::safe_load<uint32_t>(in + 5) >> 15 | turbo::safe_load<uint32_t>(in + 6) << 17};
                shifts = simd_batch{4, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 25-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 6) >> 8 | turbo::safe_load<uint32_t>(in + 7) << 24,
                                   turbo::safe_load<uint32_t>(in + 7),
                                   turbo::safe_load<uint32_t>(in + 7) >> 26 | turbo::safe_load<uint32_t>(in + 8) << 6,
                                   turbo::safe_load<uint32_t>(in + 8) >> 19 | turbo::safe_load<uint32_t>(in + 9) << 13};
                shifts = simd_batch{0, 1, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 25-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 9) >> 12 | turbo::safe_load<uint32_t>(in + 10) << 20,
                                   turbo::safe_load<uint32_t>(in + 10),
                                   turbo::safe_load<uint32_t>(in + 10) >> 30 | turbo::safe_load<uint32_t>(in + 11) << 2,
                                   turbo::safe_load<uint32_t>(in + 11) >> 23 |
                                   turbo::safe_load<uint32_t>(in + 12) << 9};
                shifts = simd_batch{0, 5, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 25-bit bundles 16 to 19
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 12) >> 16 | turbo::safe_load<uint32_t>(in + 13) << 16,
                        turbo::safe_load<uint32_t>(in + 13) >> 9 | turbo::safe_load<uint32_t>(in + 14) << 23,
                        turbo::safe_load<uint32_t>(in + 14),
                        turbo::safe_load<uint32_t>(in + 14) >> 27 | turbo::safe_load<uint32_t>(in + 15) << 5};
                shifts = simd_batch{0, 0, 2, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 25-bit bundles 20 to 23
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 15) >> 20 | turbo::safe_load<uint32_t>(in + 16) << 12,
                        turbo::safe_load<uint32_t>(in + 16) >> 13 | turbo::safe_load<uint32_t>(in + 17) << 19,
                        turbo::safe_load<uint32_t>(in + 17),
                        turbo::safe_load<uint32_t>(in + 17) >> 31 | turbo::safe_load<uint32_t>(in + 18) << 1};
                shifts = simd_batch{0, 0, 6, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 25-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 18) >> 24 | turbo::safe_load<uint32_t>(in + 19) << 8,
                                   turbo::safe_load<uint32_t>(in + 19) >> 17 |
                                   turbo::safe_load<uint32_t>(in + 20) << 15,
                                   turbo::safe_load<uint32_t>(in + 20) >> 10 |
                                   turbo::safe_load<uint32_t>(in + 21) << 22, turbo::safe_load<uint32_t>(in + 21)};
                shifts = simd_batch{0, 0, 0, 3};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 25-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 21) >> 28 | turbo::safe_load<uint32_t>(in + 22) << 4,
                                   turbo::safe_load<uint32_t>(in + 22) >> 21 |
                                   turbo::safe_load<uint32_t>(in + 23) << 11,
                                   turbo::safe_load<uint32_t>(in + 23) >> 14 |
                                   turbo::safe_load<uint32_t>(in + 24) << 18, turbo::safe_load<uint32_t>(in + 24)};
                shifts = simd_batch{0, 0, 0, 7};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 25;
                return in;
            }

            inline static const uint32_t *unpack26_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x3ffffff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 26-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 26 | turbo::safe_load<uint32_t>(in + 1) << 6,
                                   turbo::safe_load<uint32_t>(in + 1) >> 20 | turbo::safe_load<uint32_t>(in + 2) << 12,
                                   turbo::safe_load<uint32_t>(in + 2) >> 14 | turbo::safe_load<uint32_t>(in + 3) << 18};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 26-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3) >> 8 | turbo::safe_load<uint32_t>(in + 4) << 24,
                                   turbo::safe_load<uint32_t>(in + 4),
                                   turbo::safe_load<uint32_t>(in + 4) >> 28 | turbo::safe_load<uint32_t>(in + 5) << 4,
                                   turbo::safe_load<uint32_t>(in + 5) >> 22 | turbo::safe_load<uint32_t>(in + 6) << 10};
                shifts = simd_batch{0, 2, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 26-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 6) >> 16 | turbo::safe_load<uint32_t>(in + 7) << 16,
                                   turbo::safe_load<uint32_t>(in + 7) >> 10 | turbo::safe_load<uint32_t>(in + 8) << 22,
                                   turbo::safe_load<uint32_t>(in + 8),
                                   turbo::safe_load<uint32_t>(in + 8) >> 30 | turbo::safe_load<uint32_t>(in + 9) << 2};
                shifts = simd_batch{0, 0, 4, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 26-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 9) >> 24 | turbo::safe_load<uint32_t>(in + 10) << 8,
                                   turbo::safe_load<uint32_t>(in + 10) >> 18 |
                                   turbo::safe_load<uint32_t>(in + 11) << 14,
                                   turbo::safe_load<uint32_t>(in + 11) >> 12 |
                                   turbo::safe_load<uint32_t>(in + 12) << 20, turbo::safe_load<uint32_t>(in + 12)};
                shifts = simd_batch{0, 0, 0, 6};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 26-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 13),
                                   turbo::safe_load<uint32_t>(in + 13) >> 26 | turbo::safe_load<uint32_t>(in + 14) << 6,
                                   turbo::safe_load<uint32_t>(in + 14) >> 20 |
                                   turbo::safe_load<uint32_t>(in + 15) << 12,
                                   turbo::safe_load<uint32_t>(in + 15) >> 14 |
                                   turbo::safe_load<uint32_t>(in + 16) << 18};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 26-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 16) >> 8 | turbo::safe_load<uint32_t>(in + 17) << 24,
                                   turbo::safe_load<uint32_t>(in + 17),
                                   turbo::safe_load<uint32_t>(in + 17) >> 28 | turbo::safe_load<uint32_t>(in + 18) << 4,
                                   turbo::safe_load<uint32_t>(in + 18) >> 22 |
                                   turbo::safe_load<uint32_t>(in + 19) << 10};
                shifts = simd_batch{0, 2, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 26-bit bundles 24 to 27
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 19) >> 16 | turbo::safe_load<uint32_t>(in + 20) << 16,
                        turbo::safe_load<uint32_t>(in + 20) >> 10 | turbo::safe_load<uint32_t>(in + 21) << 22,
                        turbo::safe_load<uint32_t>(in + 21),
                        turbo::safe_load<uint32_t>(in + 21) >> 30 | turbo::safe_load<uint32_t>(in + 22) << 2};
                shifts = simd_batch{0, 0, 4, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 26-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 22) >> 24 | turbo::safe_load<uint32_t>(in + 23) << 8,
                                   turbo::safe_load<uint32_t>(in + 23) >> 18 |
                                   turbo::safe_load<uint32_t>(in + 24) << 14,
                                   turbo::safe_load<uint32_t>(in + 24) >> 12 |
                                   turbo::safe_load<uint32_t>(in + 25) << 20, turbo::safe_load<uint32_t>(in + 25)};
                shifts = simd_batch{0, 0, 0, 6};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 26;
                return in;
            }

            inline static const uint32_t *unpack27_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x7ffffff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 27-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 27 | turbo::safe_load<uint32_t>(in + 1) << 5,
                                   turbo::safe_load<uint32_t>(in + 1) >> 22 | turbo::safe_load<uint32_t>(in + 2) << 10,
                                   turbo::safe_load<uint32_t>(in + 2) >> 17 | turbo::safe_load<uint32_t>(in + 3) << 15};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 27-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3) >> 12 | turbo::safe_load<uint32_t>(in + 4) << 20,
                                   turbo::safe_load<uint32_t>(in + 4) >> 7 | turbo::safe_load<uint32_t>(in + 5) << 25,
                                   turbo::safe_load<uint32_t>(in + 5),
                                   turbo::safe_load<uint32_t>(in + 5) >> 29 | turbo::safe_load<uint32_t>(in + 6) << 3};
                shifts = simd_batch{0, 0, 2, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 27-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 6) >> 24 | turbo::safe_load<uint32_t>(in + 7) << 8,
                                   turbo::safe_load<uint32_t>(in + 7) >> 19 | turbo::safe_load<uint32_t>(in + 8) << 13,
                                   turbo::safe_load<uint32_t>(in + 8) >> 14 | turbo::safe_load<uint32_t>(in + 9) << 18,
                                   turbo::safe_load<uint32_t>(in + 9) >> 9 | turbo::safe_load<uint32_t>(in + 10) << 23};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 27-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 10),
                                   turbo::safe_load<uint32_t>(in + 10) >> 31 | turbo::safe_load<uint32_t>(in + 11) << 1,
                                   turbo::safe_load<uint32_t>(in + 11) >> 26 | turbo::safe_load<uint32_t>(in + 12) << 6,
                                   turbo::safe_load<uint32_t>(in + 12) >> 21 |
                                   turbo::safe_load<uint32_t>(in + 13) << 11};
                shifts = simd_batch{4, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 27-bit bundles 16 to 19
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 13) >> 16 | turbo::safe_load<uint32_t>(in + 14) << 16,
                        turbo::safe_load<uint32_t>(in + 14) >> 11 | turbo::safe_load<uint32_t>(in + 15) << 21,
                        turbo::safe_load<uint32_t>(in + 15) >> 6 | turbo::safe_load<uint32_t>(in + 16) << 26,
                        turbo::safe_load<uint32_t>(in + 16)};
                shifts = simd_batch{0, 0, 0, 1};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 27-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 16) >> 28 | turbo::safe_load<uint32_t>(in + 17) << 4,
                                   turbo::safe_load<uint32_t>(in + 17) >> 23 | turbo::safe_load<uint32_t>(in + 18) << 9,
                                   turbo::safe_load<uint32_t>(in + 18) >> 18 |
                                   turbo::safe_load<uint32_t>(in + 19) << 14,
                                   turbo::safe_load<uint32_t>(in + 19) >> 13 |
                                   turbo::safe_load<uint32_t>(in + 20) << 19};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 27-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 20) >> 8 | turbo::safe_load<uint32_t>(in + 21) << 24,
                                   turbo::safe_load<uint32_t>(in + 21),
                                   turbo::safe_load<uint32_t>(in + 21) >> 30 | turbo::safe_load<uint32_t>(in + 22) << 2,
                                   turbo::safe_load<uint32_t>(in + 22) >> 25 |
                                   turbo::safe_load<uint32_t>(in + 23) << 7};
                shifts = simd_batch{0, 3, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 27-bit bundles 28 to 31
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 23) >> 20 | turbo::safe_load<uint32_t>(in + 24) << 12,
                        turbo::safe_load<uint32_t>(in + 24) >> 15 | turbo::safe_load<uint32_t>(in + 25) << 17,
                        turbo::safe_load<uint32_t>(in + 25) >> 10 | turbo::safe_load<uint32_t>(in + 26) << 22,
                        turbo::safe_load<uint32_t>(in + 26)};
                shifts = simd_batch{0, 0, 0, 5};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 27;
                return in;
            }

            inline static const uint32_t *unpack28_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0xfffffff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 28-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 28 | turbo::safe_load<uint32_t>(in + 1) << 4,
                                   turbo::safe_load<uint32_t>(in + 1) >> 24 | turbo::safe_load<uint32_t>(in + 2) << 8,
                                   turbo::safe_load<uint32_t>(in + 2) >> 20 | turbo::safe_load<uint32_t>(in + 3) << 12};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 28-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3) >> 16 | turbo::safe_load<uint32_t>(in + 4) << 16,
                                   turbo::safe_load<uint32_t>(in + 4) >> 12 | turbo::safe_load<uint32_t>(in + 5) << 20,
                                   turbo::safe_load<uint32_t>(in + 5) >> 8 | turbo::safe_load<uint32_t>(in + 6) << 24,
                                   turbo::safe_load<uint32_t>(in + 6)};
                shifts = simd_batch{0, 0, 0, 4};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 28-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 7),
                                   turbo::safe_load<uint32_t>(in + 7) >> 28 | turbo::safe_load<uint32_t>(in + 8) << 4,
                                   turbo::safe_load<uint32_t>(in + 8) >> 24 | turbo::safe_load<uint32_t>(in + 9) << 8,
                                   turbo::safe_load<uint32_t>(in + 9) >> 20 |
                                   turbo::safe_load<uint32_t>(in + 10) << 12};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 28-bit bundles 12 to 15
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 10) >> 16 | turbo::safe_load<uint32_t>(in + 11) << 16,
                        turbo::safe_load<uint32_t>(in + 11) >> 12 | turbo::safe_load<uint32_t>(in + 12) << 20,
                        turbo::safe_load<uint32_t>(in + 12) >> 8 | turbo::safe_load<uint32_t>(in + 13) << 24,
                        turbo::safe_load<uint32_t>(in + 13)};
                shifts = simd_batch{0, 0, 0, 4};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 28-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 14),
                                   turbo::safe_load<uint32_t>(in + 14) >> 28 | turbo::safe_load<uint32_t>(in + 15) << 4,
                                   turbo::safe_load<uint32_t>(in + 15) >> 24 | turbo::safe_load<uint32_t>(in + 16) << 8,
                                   turbo::safe_load<uint32_t>(in + 16) >> 20 |
                                   turbo::safe_load<uint32_t>(in + 17) << 12};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 28-bit bundles 20 to 23
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 17) >> 16 | turbo::safe_load<uint32_t>(in + 18) << 16,
                        turbo::safe_load<uint32_t>(in + 18) >> 12 | turbo::safe_load<uint32_t>(in + 19) << 20,
                        turbo::safe_load<uint32_t>(in + 19) >> 8 | turbo::safe_load<uint32_t>(in + 20) << 24,
                        turbo::safe_load<uint32_t>(in + 20)};
                shifts = simd_batch{0, 0, 0, 4};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 28-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 21),
                                   turbo::safe_load<uint32_t>(in + 21) >> 28 | turbo::safe_load<uint32_t>(in + 22) << 4,
                                   turbo::safe_load<uint32_t>(in + 22) >> 24 | turbo::safe_load<uint32_t>(in + 23) << 8,
                                   turbo::safe_load<uint32_t>(in + 23) >> 20 |
                                   turbo::safe_load<uint32_t>(in + 24) << 12};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 28-bit bundles 28 to 31
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 24) >> 16 | turbo::safe_load<uint32_t>(in + 25) << 16,
                        turbo::safe_load<uint32_t>(in + 25) >> 12 | turbo::safe_load<uint32_t>(in + 26) << 20,
                        turbo::safe_load<uint32_t>(in + 26) >> 8 | turbo::safe_load<uint32_t>(in + 27) << 24,
                        turbo::safe_load<uint32_t>(in + 27)};
                shifts = simd_batch{0, 0, 0, 4};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 28;
                return in;
            }

            inline static const uint32_t *unpack29_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x1fffffff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 29-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 29 | turbo::safe_load<uint32_t>(in + 1) << 3,
                                   turbo::safe_load<uint32_t>(in + 1) >> 26 | turbo::safe_load<uint32_t>(in + 2) << 6,
                                   turbo::safe_load<uint32_t>(in + 2) >> 23 | turbo::safe_load<uint32_t>(in + 3) << 9};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 29-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3) >> 20 | turbo::safe_load<uint32_t>(in + 4) << 12,
                                   turbo::safe_load<uint32_t>(in + 4) >> 17 | turbo::safe_load<uint32_t>(in + 5) << 15,
                                   turbo::safe_load<uint32_t>(in + 5) >> 14 | turbo::safe_load<uint32_t>(in + 6) << 18,
                                   turbo::safe_load<uint32_t>(in + 6) >> 11 | turbo::safe_load<uint32_t>(in + 7) << 21};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 29-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 7) >> 8 | turbo::safe_load<uint32_t>(in + 8) << 24,
                                   turbo::safe_load<uint32_t>(in + 8) >> 5 | turbo::safe_load<uint32_t>(in + 9) << 27,
                                   turbo::safe_load<uint32_t>(in + 9),
                                   turbo::safe_load<uint32_t>(in + 9) >> 31 | turbo::safe_load<uint32_t>(in + 10) << 1};
                shifts = simd_batch{0, 0, 2, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 29-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 10) >> 28 | turbo::safe_load<uint32_t>(in + 11) << 4,
                                   turbo::safe_load<uint32_t>(in + 11) >> 25 | turbo::safe_load<uint32_t>(in + 12) << 7,
                                   turbo::safe_load<uint32_t>(in + 12) >> 22 |
                                   turbo::safe_load<uint32_t>(in + 13) << 10,
                                   turbo::safe_load<uint32_t>(in + 13) >> 19 |
                                   turbo::safe_load<uint32_t>(in + 14) << 13};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 29-bit bundles 16 to 19
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 14) >> 16 | turbo::safe_load<uint32_t>(in + 15) << 16,
                        turbo::safe_load<uint32_t>(in + 15) >> 13 | turbo::safe_load<uint32_t>(in + 16) << 19,
                        turbo::safe_load<uint32_t>(in + 16) >> 10 | turbo::safe_load<uint32_t>(in + 17) << 22,
                        turbo::safe_load<uint32_t>(in + 17) >> 7 | turbo::safe_load<uint32_t>(in + 18) << 25};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 29-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 18) >> 4 | turbo::safe_load<uint32_t>(in + 19) << 28,
                                   turbo::safe_load<uint32_t>(in + 19),
                                   turbo::safe_load<uint32_t>(in + 19) >> 30 | turbo::safe_load<uint32_t>(in + 20) << 2,
                                   turbo::safe_load<uint32_t>(in + 20) >> 27 |
                                   turbo::safe_load<uint32_t>(in + 21) << 5};
                shifts = simd_batch{0, 1, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 29-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 21) >> 24 | turbo::safe_load<uint32_t>(in + 22) << 8,
                                   turbo::safe_load<uint32_t>(in + 22) >> 21 |
                                   turbo::safe_load<uint32_t>(in + 23) << 11,
                                   turbo::safe_load<uint32_t>(in + 23) >> 18 |
                                   turbo::safe_load<uint32_t>(in + 24) << 14,
                                   turbo::safe_load<uint32_t>(in + 24) >> 15 |
                                   turbo::safe_load<uint32_t>(in + 25) << 17};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 29-bit bundles 28 to 31
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 25) >> 12 | turbo::safe_load<uint32_t>(in + 26) << 20,
                        turbo::safe_load<uint32_t>(in + 26) >> 9 | turbo::safe_load<uint32_t>(in + 27) << 23,
                        turbo::safe_load<uint32_t>(in + 27) >> 6 | turbo::safe_load<uint32_t>(in + 28) << 26,
                        turbo::safe_load<uint32_t>(in + 28)};
                shifts = simd_batch{0, 0, 0, 3};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 29;
                return in;
            }

            inline static const uint32_t *unpack30_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x3fffffff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 30-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 30 | turbo::safe_load<uint32_t>(in + 1) << 2,
                                   turbo::safe_load<uint32_t>(in + 1) >> 28 | turbo::safe_load<uint32_t>(in + 2) << 4,
                                   turbo::safe_load<uint32_t>(in + 2) >> 26 | turbo::safe_load<uint32_t>(in + 3) << 6};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 30-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3) >> 24 | turbo::safe_load<uint32_t>(in + 4) << 8,
                                   turbo::safe_load<uint32_t>(in + 4) >> 22 | turbo::safe_load<uint32_t>(in + 5) << 10,
                                   turbo::safe_load<uint32_t>(in + 5) >> 20 | turbo::safe_load<uint32_t>(in + 6) << 12,
                                   turbo::safe_load<uint32_t>(in + 6) >> 18 | turbo::safe_load<uint32_t>(in + 7) << 14};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 30-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 7) >> 16 | turbo::safe_load<uint32_t>(in + 8) << 16,
                                   turbo::safe_load<uint32_t>(in + 8) >> 14 | turbo::safe_load<uint32_t>(in + 9) << 18,
                                   turbo::safe_load<uint32_t>(in + 9) >> 12 | turbo::safe_load<uint32_t>(in + 10) << 20,
                                   turbo::safe_load<uint32_t>(in + 10) >> 10 |
                                   turbo::safe_load<uint32_t>(in + 11) << 22};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 30-bit bundles 12 to 15
                words = simd_batch{turbo::safe_load<uint32_t>(in + 11) >> 8 | turbo::safe_load<uint32_t>(in + 12) << 24,
                                   turbo::safe_load<uint32_t>(in + 12) >> 6 | turbo::safe_load<uint32_t>(in + 13) << 26,
                                   turbo::safe_load<uint32_t>(in + 13) >> 4 | turbo::safe_load<uint32_t>(in + 14) << 28,
                                   turbo::safe_load<uint32_t>(in + 14)};
                shifts = simd_batch{0, 0, 0, 2};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 30-bit bundles 16 to 19
                words = simd_batch{turbo::safe_load<uint32_t>(in + 15),
                                   turbo::safe_load<uint32_t>(in + 15) >> 30 | turbo::safe_load<uint32_t>(in + 16) << 2,
                                   turbo::safe_load<uint32_t>(in + 16) >> 28 | turbo::safe_load<uint32_t>(in + 17) << 4,
                                   turbo::safe_load<uint32_t>(in + 17) >> 26 |
                                   turbo::safe_load<uint32_t>(in + 18) << 6};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 30-bit bundles 20 to 23
                words = simd_batch{turbo::safe_load<uint32_t>(in + 18) >> 24 | turbo::safe_load<uint32_t>(in + 19) << 8,
                                   turbo::safe_load<uint32_t>(in + 19) >> 22 |
                                   turbo::safe_load<uint32_t>(in + 20) << 10,
                                   turbo::safe_load<uint32_t>(in + 20) >> 20 |
                                   turbo::safe_load<uint32_t>(in + 21) << 12,
                                   turbo::safe_load<uint32_t>(in + 21) >> 18 |
                                   turbo::safe_load<uint32_t>(in + 22) << 14};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 30-bit bundles 24 to 27
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 22) >> 16 | turbo::safe_load<uint32_t>(in + 23) << 16,
                        turbo::safe_load<uint32_t>(in + 23) >> 14 | turbo::safe_load<uint32_t>(in + 24) << 18,
                        turbo::safe_load<uint32_t>(in + 24) >> 12 | turbo::safe_load<uint32_t>(in + 25) << 20,
                        turbo::safe_load<uint32_t>(in + 25) >> 10 | turbo::safe_load<uint32_t>(in + 26) << 22};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 30-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 26) >> 8 | turbo::safe_load<uint32_t>(in + 27) << 24,
                                   turbo::safe_load<uint32_t>(in + 27) >> 6 | turbo::safe_load<uint32_t>(in + 28) << 26,
                                   turbo::safe_load<uint32_t>(in + 28) >> 4 | turbo::safe_load<uint32_t>(in + 29) << 28,
                                   turbo::safe_load<uint32_t>(in + 29)};
                shifts = simd_batch{0, 0, 0, 2};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 30;
                return in;
            }

            inline static const uint32_t *unpack31_32(const uint32_t *in, uint32_t *out) {
                uint32_t mask = 0x7fffffff;

                simd_batch masks(mask);
                simd_batch words, shifts;
                simd_batch results;

                // extract 31-bit bundles 0 to 3
                words = simd_batch{turbo::safe_load<uint32_t>(in + 0),
                                   turbo::safe_load<uint32_t>(in + 0) >> 31 | turbo::safe_load<uint32_t>(in + 1) << 1,
                                   turbo::safe_load<uint32_t>(in + 1) >> 30 | turbo::safe_load<uint32_t>(in + 2) << 2,
                                   turbo::safe_load<uint32_t>(in + 2) >> 29 | turbo::safe_load<uint32_t>(in + 3) << 3};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 31-bit bundles 4 to 7
                words = simd_batch{turbo::safe_load<uint32_t>(in + 3) >> 28 | turbo::safe_load<uint32_t>(in + 4) << 4,
                                   turbo::safe_load<uint32_t>(in + 4) >> 27 | turbo::safe_load<uint32_t>(in + 5) << 5,
                                   turbo::safe_load<uint32_t>(in + 5) >> 26 | turbo::safe_load<uint32_t>(in + 6) << 6,
                                   turbo::safe_load<uint32_t>(in + 6) >> 25 | turbo::safe_load<uint32_t>(in + 7) << 7};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 31-bit bundles 8 to 11
                words = simd_batch{turbo::safe_load<uint32_t>(in + 7) >> 24 | turbo::safe_load<uint32_t>(in + 8) << 8,
                                   turbo::safe_load<uint32_t>(in + 8) >> 23 | turbo::safe_load<uint32_t>(in + 9) << 9,
                                   turbo::safe_load<uint32_t>(in + 9) >> 22 | turbo::safe_load<uint32_t>(in + 10) << 10,
                                   turbo::safe_load<uint32_t>(in + 10) >> 21 |
                                   turbo::safe_load<uint32_t>(in + 11) << 11};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 31-bit bundles 12 to 15
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 11) >> 20 | turbo::safe_load<uint32_t>(in + 12) << 12,
                        turbo::safe_load<uint32_t>(in + 12) >> 19 | turbo::safe_load<uint32_t>(in + 13) << 13,
                        turbo::safe_load<uint32_t>(in + 13) >> 18 | turbo::safe_load<uint32_t>(in + 14) << 14,
                        turbo::safe_load<uint32_t>(in + 14) >> 17 | turbo::safe_load<uint32_t>(in + 15) << 15};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 31-bit bundles 16 to 19
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 15) >> 16 | turbo::safe_load<uint32_t>(in + 16) << 16,
                        turbo::safe_load<uint32_t>(in + 16) >> 15 | turbo::safe_load<uint32_t>(in + 17) << 17,
                        turbo::safe_load<uint32_t>(in + 17) >> 14 | turbo::safe_load<uint32_t>(in + 18) << 18,
                        turbo::safe_load<uint32_t>(in + 18) >> 13 | turbo::safe_load<uint32_t>(in + 19) << 19};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 31-bit bundles 20 to 23
                words = simd_batch{
                        turbo::safe_load<uint32_t>(in + 19) >> 12 | turbo::safe_load<uint32_t>(in + 20) << 20,
                        turbo::safe_load<uint32_t>(in + 20) >> 11 | turbo::safe_load<uint32_t>(in + 21) << 21,
                        turbo::safe_load<uint32_t>(in + 21) >> 10 | turbo::safe_load<uint32_t>(in + 22) << 22,
                        turbo::safe_load<uint32_t>(in + 22) >> 9 | turbo::safe_load<uint32_t>(in + 23) << 23};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 31-bit bundles 24 to 27
                words = simd_batch{turbo::safe_load<uint32_t>(in + 23) >> 8 | turbo::safe_load<uint32_t>(in + 24) << 24,
                                   turbo::safe_load<uint32_t>(in + 24) >> 7 | turbo::safe_load<uint32_t>(in + 25) << 25,
                                   turbo::safe_load<uint32_t>(in + 25) >> 6 | turbo::safe_load<uint32_t>(in + 26) << 26,
                                   turbo::safe_load<uint32_t>(in + 26) >> 5 |
                                   turbo::safe_load<uint32_t>(in + 27) << 27};
                shifts = simd_batch{0, 0, 0, 0};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                // extract 31-bit bundles 28 to 31
                words = simd_batch{turbo::safe_load<uint32_t>(in + 27) >> 4 | turbo::safe_load<uint32_t>(in + 28) << 28,
                                   turbo::safe_load<uint32_t>(in + 28) >> 3 | turbo::safe_load<uint32_t>(in + 29) << 29,
                                   turbo::safe_load<uint32_t>(in + 29) >> 2 | turbo::safe_load<uint32_t>(in + 30) << 30,
                                   turbo::safe_load<uint32_t>(in + 30)};
                shifts = simd_batch{0, 0, 0, 1};
                results = (words >> shifts) & masks;
                results.store_unaligned(out);
                out += 4;

                in += 31;
                return in;
            }

            inline static const uint32_t *unpack32_32(const uint32_t *in, uint32_t *out) {
                memcpy(out, in, 32 * sizeof(*out));
                in += 32;
                out += 32;

                return in;
            }

        };  // struct UnpackBits128

    }  // namespace
}  // namespace nebula::internal

